<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://xmlns.jcp.org/jsf/core"
      xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:composition template="/view/templates/layout.xhtml">
        <ui:define name="title">Electrocardiograma</ui:define>
        <ui:define name="menu">
            <ui:include src="/view/templates/adm-menu.xhtml"/>
        </ui:define>
        <ui:define name="toolbar">
            <h:form id="formHistoriaButtons" prependId="true">
                <p:toolbar>  
                    <p:toolbarGroup align="left">
                        <p:outputLabel value="#{msg.tlb_ecg}" style="margin-top: 5px; margin-left: 5px; "/>
                        <p:separator/>
                    </p:toolbarGroup>
                    <p:toolbarGroup align="right">
                    </p:toolbarGroup>
                </p:toolbar>
                <br/>
            </h:form>
        </ui:define>
        <ui:define name="body">
            <p:growl id="growl" globalOnly="true" showSummary="true" showDetail="true" autoUpdate="true" />

            <h:form id="formEcgEntrenar" prependId="false">
                <div id="fileUploadId">
                    <p:fileUpload widgetVar="fileWidget" 
                                  rendered="#{RecognitionPatternController.renderUpload}"
                                  fileUploadListener="#{RecognitionPatternController.executeUploadFile}" 
                                  mode="advanced" 
                                  dragDropSupport="false"  
                                  label="#{msg.med_ecg_Elegir}"
                                  uploadLabel="#{msg.med_ecg_Subir}"
                                  cancelLabel="#{msg.med_ecg_Cancelar}"
                                  update=":formEcgEntrenar :formGrafica :formGrafica:chartECG"/>  
                </div>
            </h:form>

            <h:form id="formGrafica" prependId="false">
                <h:panelGroup rendered="#{RecognitionPatternController.renderChart}">
                    <p:spinner id="minmax"  value="#{RecognitionPatternController.spinnerLine}" 
                               style="margin-right: 5px;"
                               stepFactor="0.10" min="0" max="5" >
                        <p:ajax update="chartECG" listener="#{RecognitionPatternController.executePrintLineTop}" process="@this"/>
                    </p:spinner> 
                    <p:commandButton value="#{msg.med_ecg_Segmentar}"  styleClass="ui-button-custome"
                                     actionListener="#{RecognitionPatternController.executeSegmentarSenialSupervisado}"
                                     icon="ui-icon-scissors"/>  
                    <p:commandButton value="Anterior" actionListener="#{RecognitionPatternController.executePreviousSegmento}" 
                                     styleClass="ui-button-custome"
                                     update="opcTiposArritmia chartECG"
                                     icon="ui-icon-arrowthick-1-w"/>
                    <p:commandButton value="Siguiente" actionListener="#{RecognitionPatternController.executeNextSegmento}" 
                                     styleClass="ui-button-custome"
                                     update="opcTiposArritmia chartECG"
                                     icon="ui-icon-arrowthick-1-e"/>
                    <p:commandButton value="Guardar" actionListener="#{RecognitionPatternController.executeSaveSegmentos}"
                                     icon="ui-icon-folder-open"
                                     styleClass="ui-button-custome"/>
                    <p:commandButton value="Memoria" actionListener="#{RecognitionPatternController.executeCreateMemoria}"
                                     icon="ui-icon-lightbulb"
                                     styleClass="ui-button-custome"/>
                    <p:commandButton value="Probar" actionListener="#{RecognitionPatternController.executeRecuperarPatron}" 
                                     styleClass="ui-button-custome"
                                     update="chartECG"
                                     icon="ui-icon-heart"/>

                    <p:lineChart id="chartECG" value="#{RecognitionPatternController.linearModel}" legendPosition="e" zoom="true"  
                                 title="Electrocadiograma" minY="0" maxY="5" style="height:300px" widgetVar="chart"/> 

                    <p:selectOneRadio id="opcTiposArritmia" value="#{RecognitionPatternController.opcTipoArritmia}">  
                        <f:selectItem itemLabel="Sano" itemValue="0" />  
                        <f:selectItem itemLabel="Taquicardia" itemValue="1" />  
                        <f:selectItem itemLabel="Bradicardia" itemValue="2" />  
                        <f:selectItem itemLabel="Fibrilación Auricular" itemValue="3" />  
                    </p:selectOneRadio>  
                </h:panelGroup>
            </h:form>

        </ui:define>
    </ui:composition>
</html>

